feat: configurable max gas fee with message deferral#456
Merged
hannahhoward merged 4 commits intomainfrom Mar 20, 2026
Merged
Conversation
…estion Add per-message-type gas fee limits that defer on-chain message submission when estimated fees exceed the configured maximum. Deferred messages are automatically retried when fees drop, without consuming retry budget. Closes #455 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
alanshaw
approved these changes
Mar 19, 2026
Member
There was a problem hiding this comment.
This LGTM but I think, as it stands, this will only allow dynamic configuration of the fees. To persist across restarts you'd need to add a Gas field to PDPServiceConfig.
I have opened an issue for documenting the max gas fee configuration #457
Comment on lines
+41
to
+46
| GasMaxFeeProve Key = "pdp.gas.max_fee.prove" | ||
| GasMaxFeeProvingPeriod Key = "pdp.gas.max_fee.proving_period" | ||
| GasMaxFeeProvingInit Key = "pdp.gas.max_fee.proving_init" | ||
| GasMaxFeeAddRoots Key = "pdp.gas.max_fee.add_roots" | ||
| GasMaxFeeDefault Key = "pdp.gas.max_fee.default" | ||
| GasRetryWait Key = "pdp.gas.retry_wait" |
Member
There was a problem hiding this comment.
Non-blocking and minor, but the max_fee namespace makes reading these vars very...yoda.
The suggestion below makes them a little closer to Lotus style (as was mentioned in the issue), which are IMHO a bit easier to read.
Suggested change
| GasMaxFeeProve Key = "pdp.gas.max_fee.prove" | |
| GasMaxFeeProvingPeriod Key = "pdp.gas.max_fee.proving_period" | |
| GasMaxFeeProvingInit Key = "pdp.gas.max_fee.proving_init" | |
| GasMaxFeeAddRoots Key = "pdp.gas.max_fee.add_roots" | |
| GasMaxFeeDefault Key = "pdp.gas.max_fee.default" | |
| GasRetryWait Key = "pdp.gas.retry_wait" | |
| MaxProveGasFee Key = "pdp.gas.max_prove_fee" | |
| MaxProvingPeriodGasFee Key = "pdp.gas.max_proving_period_fee" | |
| MaxProvingInitGasFee Key = "pdp.gas.max_proving_init_fee" | |
| MaxAddRootsGasFee Key = "pdp.gas.max_add_roots_fee" | |
| DefaultMaxGasFee Key = "pdp.gas.default_max_fee" | |
| GasTooHighRetryWait Key = "pdp.gas.too_high_retry_wait" |
| config.GasMaxFeeProvingPeriod: {Value: uint(0), Schema: dynamic.UintSchema{Max: ^uint(0)}}, | ||
| config.GasMaxFeeProvingInit: {Value: uint(0), Schema: dynamic.UintSchema{Max: ^uint(0)}}, | ||
| config.GasMaxFeeAddRoots: {Value: uint(0), Schema: dynamic.UintSchema{Max: ^uint(0)}}, | ||
| config.GasMaxFeeDefault: {Value: uint(0), Schema: dynamic.UintSchema{Max: ^uint(0)}}, |
Member
There was a problem hiding this comment.
Perhaps we should add a dynamic.FilCurrencyStringSchema that allows these values to be specified as a string with a "FIL" or "attoFIL" suffix e.g. "100 attoFIL".
Gas fee limits now persist across restarts via TOML config under [pdp.gas]: [pdp.gas] retry_wait = "5m" [pdp.gas.max_fee] prove = 50000000000000000 add_roots = 10000000000000000 Static config values are used as initial values for the dynamic registry. Runtime updates via admin API still work and override the static values. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds docs/content/configuration/pdp/gas.md covering: - All 6 config keys with types, defaults, and env vars - Message type descriptions and time sensitivity - Operator recommendations (conservative/permissive/no limits) - Runtime adjustment examples via admin CLI - TOML configuration examples Updates the Dynamic Configuration table in the config index and adds the gas page to the PDP section nav. Closes #457 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #455
Deliverables
pkg/config/defaults.gopkg/pdp/scheduler/handler.goErrGasTooHighsentinel error; handler requeues without incrementing retriespkg/pdp/tasks/sender_eth.goDo();RetryWaitinTypeDetails(); registry wiringpkg/fx/scheduler/messages.go*dynamic.RegistryintoSenderETHParamspkg/pdp/tasks/sender_eth_gas_test.gopkg/pdp/scheduler/engine_gas_test.goTest plan
Generated with Claude Code